import java.awt.*;
import java.awt.event.*;


public class ex_7_2 extends Frame{
	CheckboxGroup cbg;
	Label label1, label2, label3;
	Scrollbar vSlider, hSlider;
	Canvas imgCanvas;
	public ex_7_2(){
		super (" 단순 컴포넌트 - 체크박스와 라디오버튼 / 리스트와 초이스/ 수직 및 수평 스크롤바 / 이미지 캔버스");
		setLayout(new FlowLayout());
		
		add(new Checkbox("런던"));
		add(new Checkbox("베이징"));
		add(new Checkbox("도쿄"));
		add(new Checkbox("뉴욕"));
	
		cbg = new CheckboxGroup();
		add(new Checkbox("천안", cbg, false));
		add(new Checkbox("당진", cbg, false));
		add(new Checkbox("속초", cbg, false));
		add(new Checkbox("부산", cbg, false));
		
		List list = new List(3,false);
		list.add("천안");
		list.add("당진");
		list.add("속초");
		list.add("부산");
		add(list);
		
		Choice choice = new Choice();
		choice.add("천안");
		choice.add("당진");
		choice.add("속초");
		choice.add("부산");
		add(choice);
		
		label1 = new Label("수직 스크롤바: ", label1.CENTER);
		label2 = new Label("수평 스크롤바: ", label2.CENTER);
		
		vSlider = new Scrollbar(Scrollbar.VERTICAL, 0,1,0,100);
		hSlider = new Scrollbar(Scrollbar.HORIZONTAL, 0,4,0,50);
		
		add(label1);
		add(vSlider);
		add(label2);
		add(hSlider);
		label3 = new Label("이미지 캔버스: ", label3.CENTER);
		imgCanvas = new Canvas();
		imgCanvas.setBackground(Color.yellow);
		imgCanvas.setSize(200,150);
		add(label3);
		add(imgCanvas);
		setSize(600,300);
		setVisible(true);
		
		 this.addWindowListener(new WinEvent());// 윈도우 이벤트
	}
	public static void main(String[] args){
		ex_7_2 ex = new ex_7_2();
	}
}

class WinEvent implements WindowListener{


    public void windowActivated(WindowEvent e){}

    public void windowClosed(WindowEvent e){}

    public void windowClosing(WindowEvent e){

        System.exit(0);// X를 누르면 종료된다.

    }

    public void windowDeactivated(WindowEvent e){}

    public void windowDeiconified(WindowEvent e){}

    public void windowIconified(WindowEvent e){}

    public void windowOpened(WindowEvent e){}


}
